<?php
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . "/js/dist/js/jquery.bootstrap-duallistbox.js");
Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . "/css/dist/css/bootstrap-duallistbox.css");

$this->breadcrumbs = array(
    '推荐主题管理' => array('/advice/adviceTopic'),
    '选择推荐主题'
);
$action = $model->isNewRecord ? 'link' : '?id='.$model->id;
?>
<?php
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id' => 'CreateForm',
    'type' => 'horizontal',
    'enableAjaxValidation' => false,

));
?>
<div class="row">
    <blockquote><b>已经推荐主题:
            <?php
            $html = '';
            foreach ($model->extids as $ext) {
                $html .= ('<span style="color: green">' . Topic::model()->findByPk($ext)->name . '&nbsp;&nbsp;&nbsp;</span>');
            }
            echo $html;
            ?>
        </b>
    </blockquote>

    <blockquote><b>选择推荐主题</b></blockquote>
    <div class="col-md-12">
        <?php
       if($form instanceof TbActiveForm)
       {
           $itemHtml = '';
           $serieses = Series::getOptions('series');
           foreach ($serieses as $sid => $series) {
               $tids = [];
               foreach (Series::model()->findByPk($sid)->topics as $topic) {
                   $tids [$topic->id] = $topic->name;
               }
               echo '<div class="col-lg-offset-3"><b>'.$series.'&emsp;</b></div>';
               echo $form->checkBoxListInlineRow($model, 'extids', $tids,
                   ['labelOptions'=>['style'=>'visibility:hidden;']]);
        }
       }
        ?>
    </div>
    <div class="col-md-offset-4 col-md-3">
    <?php
    $this->widget('bootstrap.widgets.TbButton', array(
        'label' => '新增',
        'buttonType' => 'submit',
        'htmlOptions' => array('class' => 'pull-right btn-success', 'style' => 'width:100%'),
    ));
    ?>
    </div>
</div>
<?php
$this->endWidget();
?>
<script>


</script>
